//
//  UILable + Extension.swift
//  WeiBo
//
//  Created by 陈贵 on 15/9/12.
//  Copyright © 2015年 hzj. All rights reserved.
//




// MARK: - 当layoutWidth大于某值时便是多行文本
import UIKit

extension UILabel{
    
    convenience init(title:String?,color:UIColor,fontSize:CGFloat,layoutWidth:CGFloat = 0){
        self.init()
        text = title
        textColor = color
        font = UIFont.systemFontOfSize(fontSize)
        textAlignment = NSTextAlignment.Center
        if layoutWidth > 0 {
            preferredMaxLayoutWidth = layoutWidth
            numberOfLines = 0
        }
        sizeToFit()
    }
}